package com.yunhe.gateway.controller;

import com.yunhe.gateway.constant.ErrorCode;
import com.yunhe.common.model.ResultObject;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 网关Controller
 * @author liuronglei
 */
@RestController
public class GatewayController {

    /**
     * 降级处理的控制器定义
     * @return
     */
    @RequestMapping(value = "/fallbackcontroller")
    public ResponseEntity<ResultObject> fallBackController() {
        ResultObject resultObject = new ResultObject(ErrorCode.CODE.HYSTRIX_ERROR.value(), "网关熔断");
        return new ResponseEntity<>(resultObject, HttpStatus.OK);
    }
}